/*  ----------------------------------------------------------------------------
 *  Warren Moxley
 *  ----------------------------------------------------------------------------
 *  GoogleHelper
 *  ----------------------------------------------------------------------------
 *  File:       TasksService.cs
 *  Author:     IT1SERVICES\wmoxley
 *  ----------------------------------------------------------------------------
	Licensed to the Apache Software Foundation (ASF) under one
       	or more contributor license agreements.  See the NOTICE file
       	distributed with this work for additional information
       	regarding copyright ownership.  The ASF licenses this file
       	to you under the Apache License, Version 2.0 (the
       	"License"); you may not use this file except in compliance
       	with the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

       	Unless required by applicable law or agreed to in writing,
       	software distributed under the License is distributed on an
       	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       	KIND, either express or implied.  See the License for the
       	specific language governing permissions and limitations
       	under the License. 
 *  ----------------------------------------------------------------------------
*/

namespace Google.Apis.Wrappers.Tasks.Data {
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using Newtonsoft.Json;
    
    public class Task {
        
        private string completed;
        
        private bool deleted;
        
        private string due;
        
        private string etag;
        
        private bool hidden;
        
        private string id;
        
        private string kind;
        
        private string notes;
        
        private string parent;
        
        private string position;
        
        private string selfLink;
        
        private string status;
        
        private string title;
        
        private string updated;
        
        /// <summary>Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("completed")]
        public virtual string Completed {
            get {
                return this.completed;
            }
            set {
                this.completed = value;
            }
        }
        
        /// <summary>Flag indicating whether the task has been deleted. The default if False.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("deleted")]
        public virtual bool Deleted {
            get {
                return this.deleted;
            }
            set {
                this.deleted = value;
            }
        }
        
        /// <summary>Due date of the task (as a RFC 3339 timestamp). Optional.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("due")]
        public virtual string Due {
            get {
                return this.due;
            }
            set {
                this.due = value;
            }
        }
        
        /// <summary>ETag of the resource.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("etag")]
        public virtual string Etag {
            get {
                return this.etag;
            }
            set {
                this.etag = value;
            }
        }
        
        /// <summary>Flag indicating whether the task is hidden. This is the case if the task had been marked completed when the task list was last cleared. The default is False. This field is read-only.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("hidden")]
        public virtual bool Hidden {
            get {
                return this.hidden;
            }
            set {
                this.hidden = value;
            }
        }
        
        /// <summary>Task identifier.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id {
            get {
                return this.id;
            }
            set {
                this.id = value;
            }
        }
        
        /// <summary>Type of the resource. This is always &quot;tasks#task&quot;.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("kind")]
        public virtual string Kind {
            get {
                return this.kind;
            }
            set {
                this.kind = value;
            }
        }
        
        /// <summary>Notes describing the task. Optional.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("notes")]
        public virtual string Notes {
            get {
                return this.notes;
            }
            set {
                this.notes = value;
            }
        }
        
        /// <summary>Parent task identifier. This field is omitted if it is a top-level task. This field is read-only. Use the &quot;move&quot; method to move the task under a different parent or to the top level.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("parent")]
        public virtual string Parent {
            get {
                return this.parent;
            }
            set {
                this.parent = value;
            }
        }
        
        /// <summary>String indicating the position of the task among its sibling tasks under the same parent task or at the top level. If this string is greater than another task&apos;s corresponding position string according to lexicographical ordering, the task is positioned after the other task under the same parent task (or at the top level). This field is read-only. Use the &quot;move&quot; method to move the task to another position.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("position")]
        public virtual string Position {
            get {
                return this.position;
            }
            set {
                this.position = value;
            }
        }
        
        /// <summary>URL pointing to this task. Used to retrieve, update, or delete this task.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("selfLink")]
        public virtual string SelfLink {
            get {
                return this.selfLink;
            }
            set {
                this.selfLink = value;
            }
        }
        
        /// <summary>Status of the task. This is either &quot;needsAction&quot; or &quot;completed&quot;.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("status")]
        public virtual string Status {
            get {
                return this.status;
            }
            set {
                this.status = value;
            }
        }
        
        /// <summary>Title of the task.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("title")]
        public virtual string Title {
            get {
                return this.title;
            }
            set {
                this.title = value;
            }
        }
        
        /// <summary>Last modification time of the task (as a RFC 3339 timestamp).</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("updated")]
        public virtual string Updated {
            get {
                return this.updated;
            }
            set {
                this.updated = value;
            }
        }
    }
    
    public class TaskList {
        
        private string etag;
        
        private string id;
        
        private string kind;
        
        private string selfLink;
        
        private string title;
        
        /// <summary>ETag of the resource.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("etag")]
        public virtual string Etag {
            get {
                return this.etag;
            }
            set {
                this.etag = value;
            }
        }
        
        /// <summary>Task list identifier.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id {
            get {
                return this.id;
            }
            set {
                this.id = value;
            }
        }
        
        /// <summary>Type of the resource. This is always &quot;tasks#taskList&quot;.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("kind")]
        public virtual string Kind {
            get {
                return this.kind;
            }
            set {
                this.kind = value;
            }
        }
        
        /// <summary>URL pointing to this task list. Used to retrieve, update, or delete this task list.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("selfLink")]
        public virtual string SelfLink {
            get {
                return this.selfLink;
            }
            set {
                this.selfLink = value;
            }
        }
        
        /// <summary>Title of the task list.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("title")]
        public virtual string Title {
            get {
                return this.title;
            }
            set {
                this.title = value;
            }
        }
    }
    
    public class TaskLists {
        
        private string etag;
        
        private IList<TaskList> items;
        
        private string kind;
        
        private string nextPageToken;
        
        /// <summary>ETag of the resource.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("etag")]
        public virtual string Etag {
            get {
                return this.etag;
            }
            set {
                this.etag = value;
            }
        }
        
        /// <summary>Collection of task lists.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("items")]
        public virtual IList<TaskList> Items {
            get {
                return this.items;
            }
            set {
                this.items = value;
            }
        }
        
        /// <summary>Type of the resource. This is always &quot;tasks#taskLists&quot;.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("kind")]
        public virtual string Kind {
            get {
                return this.kind;
            }
            set {
                this.kind = value;
            }
        }
        
        /// <summary>Token that can be used to request the next page of this result.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken {
            get {
                return this.nextPageToken;
            }
            set {
                this.nextPageToken = value;
            }
        }
    }
    
    public class Tasks {
        
        private string etag;
        
        private IList<Task> items;
        
        private string kind;
        
        private string nextPageToken;
        
        /// <summary>ETag of the resource.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("etag")]
        public virtual string Etag {
            get {
                return this.etag;
            }
            set {
                this.etag = value;
            }
        }
        
        /// <summary>Collection of tasks.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("items")]
        public virtual IList<Task> Items {
            get {
                return this.items;
            }
            set {
                this.items = value;
            }
        }
        
        /// <summary>Type of the resource. This is always &quot;tasks#tasks&quot;.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("kind")]
        public virtual string Kind {
            get {
                return this.kind;
            }
            set {
                this.kind = value;
            }
        }
        
        /// <summary>Token used to access the next page of this result.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken {
            get {
                return this.nextPageToken;
            }
            set {
                this.nextPageToken = value;
            }
        }
    }
}
namespace Google.Apis.Wrappers.Tasks {
    using System;
    using System.IO;
    using System.Collections.Generic;
    using Google.Apis;
    using Google.Apis.Discovery;
    
    
    public class TasksService : Google.Apis.Discovery.IRequestExecutor, Google.Apis.Discovery.ISchemaAwareRequestExecutor {
        
        private Google.Apis.Discovery.IService genericService;
        
        private Google.Apis.Authentication.IAuthenticator authenticator;
        
        private const string Version = "v1";
        
        private const string Name = "tasks";
        
        private const string BaseUri = "https://www.googleapis.com/tasks/v1/";
        
        private const Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed = Google.Apis.Discovery.DiscoveryVersion.Version_0_3;
        
        private Newtonsoft.Json.JsonSerializer newtonJsonSerilizer = null;
        
        private Tasklists tasklists;
        
        private Tasks tasks;

        private string developerKey;

        private string appName;

        public TasksService(Google.Apis.Discovery.IService genericService, Google.Apis.Authentication.IAuthenticator authenticator, string developerKey, string appName)
        {
            this.genericService = genericService;
            this.authenticator = authenticator;
            this.tasklists = new Tasklists(this);
            this.tasks = new Tasks(this);
            this.developerKey = developerKey;
            this.appName = appName;
        }

        public TasksService(Google.Apis.Authentication.IAuthenticator authenticator, string developerKey, string appName) :
            this(new Google.Apis.Discovery.DiscoveryService(new Google.Apis.Discovery.WebDiscoveryDevice(new System.Uri(string.Format("https://www.googleapis.com/discovery/v0.3/describe/{0}/{1}", TasksService.Name, TasksService.Version)))).GetService(TasksService.Version, TasksService.DiscoveryVersionUsed, new Google.Apis.Discovery.FactoryParameterV0_3(null, TasksService.BaseUri)), authenticator, developerKey, appName)
        {
        }
        
        public TasksService(string developerKey, string appName) : 
                this(new Google.Apis.Discovery.DiscoveryService(new Google.Apis.Discovery.WebDiscoveryDevice(new System.Uri(string.Format("https://www.googleapis.com/discovery/v0.3/describe/{0}/{1}", TasksService.Name, TasksService.Version)))).GetService(TasksService.Version, TasksService.DiscoveryVersionUsed, new Google.Apis.Discovery.FactoryParameterV0_3(null, TasksService.BaseUri)), Google.Apis.Authentication.AuthenticatorFactory.GetInstance().GetRegisteredAuthenticator(), developerKey, appName) {
        }
        
        private Newtonsoft.Json.JsonSerializer NewtonJsonSerilizer {
            get {
                if ((this.newtonJsonSerilizer == null)) {
                    Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings();
                    settings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
                    this.newtonJsonSerilizer = Newtonsoft.Json.JsonSerializer.Create(settings);
                }
                return this.newtonJsonSerilizer;
            }
        }
        
        public virtual Tasklists Tasklists {
            get {
                return this.tasklists;
            }
        }
        
        public virtual Tasks Tasks {
            get {
                return this.tasks;
            }
        }
        
        public virtual System.IO.Stream ExecuteRequest(string resource, string method, string body, System.Collections.Generic.IDictionary<string, object> parameters) {
            Google.Apis.Requests.IRequest request = this.genericService.CreateRequest(resource, method);
            return request.WithDeveloperKey(developerKey).WithParameters(parameters).WithAuthentication(authenticator).WithBody(body).WithAppName(appName).ExecuteRequest();
        }
        
        public virtual System.IO.Stream ExecuteRequest(string resource, string method, object body, System.Collections.Generic.IDictionary<string, object> parameters) {
            return this.ExecuteRequest(resource, method, this.ObjectToJson(body), parameters);
        }
        
        public virtual string ObjectToJson(object obj) {
            System.IO.TextWriter tw = new System.IO.StringWriter();
            this.NewtonJsonSerilizer.Serialize(tw, obj);
            return tw.ToString();
        }
        
        public virtual TOutput JsonToObject<TOutput>(System.IO.Stream stream)
         {
            System.IO.StreamReader streamReader = new System.IO.StreamReader(stream);
            string str = streamReader.ReadToEnd();

            if (!str.Contains("data:"))
                str = "{\"data\":" + str + "}";

            try {
                Google.Apis.Util.StandardResponse<TOutput> response = Newtonsoft.Json.JsonConvert.DeserializeObject<Google.Apis.Util.StandardResponse<TOutput>>(str);
                if ((response.Data == null)) {
                    throw new System.ApplicationException(string.Format("Failed to get response from stream, error was [{0}]", response.Error));
                }
                return response.Data;
            }
            catch (System.Exception ex) {
                throw new System.ApplicationException(string.Format("Failed to generate object of type[{0}] from Json[{1}]", typeof(TOutput).Name, str), ex);
            }
        }
    }
    
    public class Tasklists {
        
        private Google.Apis.Discovery.ISchemaAwareRequestExecutor service;
        
        private const string Resource = "tasklists";
        
        private log4net.ILog logger = log4net.LogManager.GetLogger(typeof(Tasklists));
        
        public Tasklists(TasksService service) {
            this.service = service;
        }
        
        /// <summary>Deletes the authenticated user&apos;s specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Delete(string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasklists.delete");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasklists.Resource, "delete", body, parameters);
            logger.Debug("Done Executing tasklists.delete");
            return ret;
        }
        
        /// <summary>Returns the authenticated user&apos;s specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Get(string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasklists.get");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasklists.Resource, "get", body, parameters);
            logger.Debug("Done Executing tasklists.get");
            return ret;
        }
        
        /// <summary>Creates a new task list and adds it to the authenticated user&apos;s task lists.</summary>
        public virtual System.IO.Stream Insert(string body) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            logger.Debug("Executing tasklists.insert");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasklists.Resource, "insert", body, parameters);
            logger.Debug("Done Executing tasklists.insert");
            return ret;
        }
        
        /// <summary>Returns all the authenticated user&apos;s task lists.</summary>
        /// <param name="maxResults">Optional - Minimum value of -9223372036854775808 - Maximum value of 9223372036854775807 - Maximum number of task lists returned on one page. Optional. The default is 100.</param>
        /// <param name="pageToken">Optional - Token specifying the result page to return. Optional.</param>
        public virtual System.IO.Stream List(long maxResults, string pageToken) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["maxResults"] = maxResults;
            parameters["pageToken"] = pageToken;
            logger.Debug("Executing tasklists.list");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasklists.Resource, "list", body, parameters);
            logger.Debug("Done Executing tasklists.list");
            return ret;
        }
        
        /// <summary>Updates the authenticated user&apos;s specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Update(string body, string tasklist) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasklists.update");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasklists.Resource, "update", body, parameters);
            logger.Debug("Done Executing tasklists.update");
            return ret;
        }
        
        /// <summary>Deletes the authenticated user&apos;s specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream DeleteAsObject(string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasklists.delete");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasklists.Resource, "delete", body, parameters);
            logger.Debug("Done Executing tasklists.delete");
            return ret;
        }
        
        /// <summary>Returns the authenticated user&apos;s specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.TaskList GetAsObject(string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasklists.get");
            Google.Apis.Wrappers.Tasks.Data.TaskList ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.TaskList>(this.service.ExecuteRequest(Tasklists.Resource, "get", body, parameters));
            logger.Debug("Done Executing tasklists.get");
            return ret;
        }
        
        /// <summary>Creates a new task list and adds it to the authenticated user&apos;s task lists.</summary>
        public virtual Google.Apis.Wrappers.Tasks.Data.TaskList InsertAsObject(Google.Apis.Wrappers.Tasks.Data.TaskList body) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            logger.Debug("Executing tasklists.insert");
            Google.Apis.Wrappers.Tasks.Data.TaskList ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.TaskList>(this.service.ExecuteRequest(Tasklists.Resource, "insert", body, parameters));
            logger.Debug("Done Executing tasklists.insert");
            return ret;
        }
        
        /// <summary>Returns all the authenticated user&apos;s task lists.</summary>
        /// <param name="maxResults">Optional - Minimum value of -9223372036854775808 - Maximum value of 9223372036854775807 - Maximum number of task lists returned on one page. Optional. The default is 100.</param>
        /// <param name="pageToken">Optional - Token specifying the result page to return. Optional.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.TaskLists ListAsObject(long maxResults, string pageToken) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["maxResults"] = maxResults;
            parameters["pageToken"] = pageToken;
            logger.Debug("Executing tasklists.list");
            Google.Apis.Wrappers.Tasks.Data.TaskLists ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.TaskLists>(this.service.ExecuteRequest(Tasklists.Resource, "list", body, parameters));
            logger.Debug("Done Executing tasklists.list");
            return ret;
        }
        
        /// <summary>Updates the authenticated user&apos;s specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.TaskList UpdateAsObject(Google.Apis.Wrappers.Tasks.Data.TaskList body, string tasklist) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasklists.update");
            Google.Apis.Wrappers.Tasks.Data.TaskList ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.TaskList>(this.service.ExecuteRequest(Tasklists.Resource, "update", body, parameters));
            logger.Debug("Done Executing tasklists.update");
            return ret;
        }
        
        /// <summary>Returns all the authenticated user&apos;s task lists.</summary>
        public virtual System.IO.Stream List(System.Collections.Generic.IDictionary<string, object> parameters) {
            string body = null;
            logger.Debug("Executing tasklists.list");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasklists.Resource, "list", body, parameters);
            logger.Debug("Done Executing tasklists.list");
            return ret;
        }
    }
    
    public class Tasks {
        
        private Google.Apis.Discovery.ISchemaAwareRequestExecutor service;
        
        private const string Resource = "tasks";
        
        private log4net.ILog logger = log4net.LogManager.GetLogger(typeof(Tasks));
        
        public Tasks(TasksService service) {
            this.service = service;
        }
        
        /// <summary>Clears all completed tasks from the specified task list. The affected tasks will be marked as &apos;hidden&apos; and no longer be returned by default when retrieving all tasks for a task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Clear(string body, string tasklist) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.clear");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "clear", body, parameters);
            logger.Debug("Done Executing tasks.clear");
            return ret;
        }
        
        /// <summary>Deletes the specified task from the task list.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Delete(string task, string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.delete");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "delete", body, parameters);
            logger.Debug("Done Executing tasks.delete");
            return ret;
        }
        
        /// <summary>Returns the specified task.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Get(string task, string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.get");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "get", body, parameters);
            logger.Debug("Done Executing tasks.get");
            return ret;
        }
        
        /// <summary>Creates a new task on the specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        /// <param name="parent">Optional - Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.</param>
        /// <param name="previous">Optional - Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.</param>
        public virtual System.IO.Stream Insert(string body, string tasklist, string parent, string previous) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            parameters["parent"] = parent;
            parameters["previous"] = previous;
            logger.Debug("Executing tasks.insert");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "insert", body, parameters);
            logger.Debug("Done Executing tasks.insert");
            return ret;
        }
        
        /// <summary>Returns all tasks in the specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        /// <param name="completedMax">Optional - Upper bound for a task&apos;s completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.</param>
        /// <param name="completedMin">Optional - Lower bound for a task&apos;s completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.</param>
        /// <param name="dueMax">Optional - Upper bound for a task&apos;s due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.</param>
        /// <param name="dueMin">Optional - Lower bound for a task&apos;s due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.</param>
        /// <param name="maxResults">Optional - Minimum value of -9223372036854775808 - Maximum value of 9223372036854775807 - Maximum number of task lists returned on one page. Optional. The default is 100.</param>
        /// <param name="pageToken">Optional - Token specifying the result page to return. Optional.</param>
        /// <param name="showCompleted">Optional - Flag indicating whether completed tasks are returned in the result. Optional. The default is True.</param>
        /// <param name="showDeleted">Optional - Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.</param>
        /// <param name="showHidden">Optional - Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.</param>
        /// <param name="updatedMin">Optional - Lower bound for a task&apos;s last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time.</param>
        public virtual System.IO.Stream List(string tasklist, string completedMax, string completedMin, string dueMax, string dueMin, long maxResults, string pageToken, bool showCompleted, bool showDeleted, bool showHidden, string updatedMin) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            parameters["completedMax"] = completedMax;
            parameters["completedMin"] = completedMin;
            parameters["dueMax"] = dueMax;
            parameters["dueMin"] = dueMin;
            parameters["maxResults"] = maxResults;
            parameters["pageToken"] = pageToken;
            parameters["showCompleted"] = showCompleted;
            parameters["showDeleted"] = showDeleted;
            parameters["showHidden"] = showHidden;
            parameters["updatedMin"] = updatedMin;
            logger.Debug("Executing tasks.list");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "list", body, parameters);
            logger.Debug("Done Executing tasks.list");
            return ret;
        }
        
        /// <summary>Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        /// <param name="parent">Optional - New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional.</param>
        /// <param name="previous">Optional - New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional.</param>
        public virtual System.IO.Stream Move(string body, string task, string tasklist, string parent, string previous) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            parameters["parent"] = parent;
            parameters["previous"] = previous;
            logger.Debug("Executing tasks.move");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "move", body, parameters);
            logger.Debug("Done Executing tasks.move");
            return ret;
        }
        
        /// <summary>Updates the specified task.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Update(string body, string task, string tasklist) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.update");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "update", body, parameters);
            logger.Debug("Done Executing tasks.update");
            return ret;
        }
        
        /// <summary>Clears all completed tasks from the specified task list. The affected tasks will be marked as &apos;hidden&apos; and no longer be returned by default when retrieving all tasks for a task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream ClearAsObject(string body, string tasklist) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.clear");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "clear", body, parameters);
            logger.Debug("Done Executing tasks.clear");
            return ret;
        }
        
        /// <summary>Deletes the specified task from the task list.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream DeleteAsObject(string task, string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.delete");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "delete", body, parameters);
            logger.Debug("Done Executing tasks.delete");
            return ret;
        }
        
        /// <summary>Returns the specified task.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.Task GetAsObject(string task, string tasklist) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.get");
            Google.Apis.Wrappers.Tasks.Data.Task ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.Task>(this.service.ExecuteRequest(Tasks.Resource, "get", body, parameters));
            logger.Debug("Done Executing tasks.get");
            return ret;
        }
        
        /// <summary>Creates a new task on the specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        /// <param name="parent">Optional - Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.</param>
        /// <param name="previous">Optional - Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.Task InsertAsObject(Google.Apis.Wrappers.Tasks.Data.Task body, string tasklist, string parent, string previous) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            parameters["parent"] = parent;
            parameters["previous"] = previous;
            logger.Debug("Executing tasks.insert");
            Google.Apis.Wrappers.Tasks.Data.Task ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.Task>(this.service.ExecuteRequest(Tasks.Resource, "insert", body, parameters));
            logger.Debug("Done Executing tasks.insert");
            return ret;
        }
        
        /// <summary>Returns all tasks in the specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        /// <param name="completedMax">Optional - Upper bound for a task&apos;s completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.</param>
        /// <param name="completedMin">Optional - Lower bound for a task&apos;s completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.</param>
        /// <param name="dueMax">Optional - Upper bound for a task&apos;s due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.</param>
        /// <param name="dueMin">Optional - Lower bound for a task&apos;s due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.</param>
        /// <param name="maxResults">Optional - Minimum value of -9223372036854775808 - Maximum value of 9223372036854775807 - Maximum number of task lists returned on one page. Optional. The default is 100.</param>
        /// <param name="pageToken">Optional - Token specifying the result page to return. Optional.</param>
        /// <param name="showCompleted">Optional - Flag indicating whether completed tasks are returned in the result. Optional. The default is True.</param>
        /// <param name="showDeleted">Optional - Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.</param>
        /// <param name="showHidden">Optional - Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.</param>
        /// <param name="updatedMin">Optional - Lower bound for a task&apos;s last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.Tasks ListAsObject(string tasklist, string completedMax, string completedMin, string dueMax, string dueMin, long maxResults, string pageToken, bool showCompleted, bool showDeleted, bool showHidden, string updatedMin) {
            string body = null;
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["tasklist"] = tasklist;
            parameters["completedMax"] = completedMax;
            parameters["completedMin"] = completedMin;
            parameters["dueMax"] = dueMax;
            parameters["dueMin"] = dueMin;
            parameters["maxResults"] = maxResults;
            parameters["pageToken"] = pageToken;
            parameters["showCompleted"] = showCompleted;
            parameters["showDeleted"] = showDeleted;
            parameters["showHidden"] = showHidden;
            parameters["updatedMin"] = updatedMin;
            logger.Debug("Executing tasks.list");
            Google.Apis.Wrappers.Tasks.Data.Tasks ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.Tasks>(this.service.ExecuteRequest(Tasks.Resource, "list", body, parameters));
            logger.Debug("Done Executing tasks.list");
            return ret;
        }
        
        /// <summary>Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        /// <param name="parent">Optional - New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional.</param>
        /// <param name="previous">Optional - New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.Task MoveAsObject(string body, string task, string tasklist, string parent, string previous) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            parameters["parent"] = parent;
            parameters["previous"] = previous;
            logger.Debug("Executing tasks.move");
            Google.Apis.Wrappers.Tasks.Data.Task ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.Task>(this.service.ExecuteRequest(Tasks.Resource, "move", body, parameters));
            logger.Debug("Done Executing tasks.move");
            return ret;
        }
        
        /// <summary>Updates the specified task.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual Google.Apis.Wrappers.Tasks.Data.Task UpdateAsObject(Google.Apis.Wrappers.Tasks.Data.Task body, string task, string tasklist) {
            System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>();
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.update");

            Google.Apis.Wrappers.Tasks.Data.Task ret = this.service.JsonToObject<Google.Apis.Wrappers.Tasks.Data.Task>(this.service.ExecuteRequest(Tasks.Resource, "update", body, parameters));
            logger.Debug("Done Executing tasks.update");
            return ret;
        }
        
        /// <summary>Creates a new task on the specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Insert(string body, string tasklist, System.Collections.Generic.IDictionary<string, object> parameters) {
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.insert");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "insert", body, parameters);
            logger.Debug("Done Executing tasks.insert");
            return ret;
        }
        
        /// <summary>Returns all tasks in the specified task list.</summary>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream List(string tasklist, System.Collections.Generic.IDictionary<string, object> parameters) {
            string body = null;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.list");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "list", body, parameters);
            logger.Debug("Done Executing tasks.list");
            return ret;
        }
        
        /// <summary>Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks.</summary>
        /// <param name="task">Required - Task identifier.</param>
        /// <param name="tasklist">Required - Task list identifier.</param>
        public virtual System.IO.Stream Move(string body, string task, string tasklist, System.Collections.Generic.IDictionary<string, object> parameters) {
            parameters["task"] = task;
            parameters["tasklist"] = tasklist;
            logger.Debug("Executing tasks.move");
            System.IO.Stream ret = this.service.ExecuteRequest(Tasks.Resource, "move", body, parameters);
            logger.Debug("Done Executing tasks.move");
            return ret;
        }
    }
}
